import { IsBoolean, IsIn, IsNumber, IsOptional, IsString } from "class-validator";
import { Tag } from "../../tags/entities/tag.entity";

export class CreateContentDto {
  @IsNumber()
  @IsOptional()
  readonly parentId: number;

  @IsNumber()
  @IsOptional()
  readonly topLevelId: number;

  @IsString()
  readonly title: string;

  @IsString()
  readonly description: string

  @IsString()
  readonly content: string;

  @IsString({ each: true })
  readonly tags: Tag[];

  @IsString()
  @IsOptional()
  readonly cover?: string;

  @IsString()
  @IsIn(['article', 'category'])
  type: "article" | "category";

  @IsNumber()
  @IsOptional()
  readonly status?: number = 1;

  @IsNumber()
  @IsOptional()
  sortOrder?: number = 0;

  @IsBoolean()
  @IsOptional()
  readonly top?: boolean = false;

  @IsNumber()
  @IsOptional()
  readonly browse?: number;

  @IsNumber()
  @IsOptional()
  readonly likes?: number;

  @IsString()
  readonly authorId: string;


}
